package cn.cs.service;

import cn.cs.mapper.AgentInvoiceMapper;
import cn.cs.pojo.AgentInvoice;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


@RestController
public class AgentInvoiceService {

    @Resource
    private AgentInvoiceMapper agentInvoiceMapper;

    @RequestMapping(value = "/getAgentInvoiceById", method = RequestMethod.POST)
    public AgentInvoice getAgentInvoiceById(@RequestParam("id") String id) throws Exception{
        return agentInvoiceMapper.getAgentInvoiceById(id);
    }

    @RequestMapping(value = "/getAgentInvoiceByOrderNum", method = RequestMethod.POST)
    public AgentInvoice getAgentInvoiceByOrderNum(@RequestParam("orderNum") String orderNum) throws Exception{
        return agentInvoiceMapper.getAgentInvoiceByOrderNum(orderNum);
    }

    @RequestMapping(value = "/getAgentInvoiceListByMap", method = RequestMethod.POST)
    public List<AgentInvoice> getAgentInvoiceListByMap(Map<String, Object> param) throws Exception{
        return agentInvoiceMapper.getAgentInvoiceListByMap(param);
    }

    @RequestMapping(value = "/getAgentInvoiceCountByMap", method = RequestMethod.POST)
    public Integer getAgentInvoiceCountByMap(Map<String, Object> param) throws Exception{
        return agentInvoiceMapper.getAgentInvoiceCountByMap(param);
    }

    @RequestMapping(value = "/insertAgentInvoice", method = RequestMethod.POST)
    public Integer insertAgentInvoice(AgentInvoice agentInvoice) throws Exception{
        return agentInvoiceMapper.insertAgentInvoice(agentInvoice);
    }

    @RequestMapping(value = "/updateAgentInvoice", method = RequestMethod.POST)
    public Integer updateAgentInvoice(AgentInvoice agentInvoice) throws Exception{
        return agentInvoiceMapper.updateAgentInvoice(agentInvoice);
    }

    @RequestMapping(value = "/deleteAgentInvoiceById", method = RequestMethod.POST)
    public Integer deleteAgentInvoiceById(@RequestParam("id") String id) throws Exception{
        return agentInvoiceMapper.deleteAgentInvoiceById(id);
    }

}
